/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.common.service.base.processor.pre;

import info.peigen.hotpot.common.service.base.event.LogEventHandler;
import info.peigen.hotpot.common.service.base.event.ServiceOrderLogEvent;
import info.peigen.hotpot.common.service.base.processor.Processor;
import info.peigen.hotpot.common.service.base.processor.ProcessorServiceContext;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;

/**
 * <b>(PreLogEventProcessor)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/5/26
 */
@SuppressWarnings({"unused", "rawtypes"})
@Component
public class PreLogEventProcessor implements Processor {

    @Inject
    protected LogEventHandler logEventHandler;

    @Override
    public Integer level() {
        return TOP_LEVEL;
    }

    @Override
    public void execute(ProcessorServiceContext serviceContext) {
        // 0. 打印[开始]日志
        logEventHandler.eventPost(ServiceOrderLogEvent.builder().order(serviceContext.getOrder()).build());
    }
}
